import { ObjectType } from "esy-tools"
import { Select } from "esy-ui"
import React from "react"

const options = [
    {
        value: "A",
        key: 1,
        text: "A"
    },
    {
        value: "B",
        key: 2,
        text: "B"
    }
]

const ops = [
    { dataLabel: 235, dataValue: 1 },
    { dataLabel: 234, dataValue: 2 },
    { dataLabel: 567, dataValue: 3 },
    { dataLabel: 890, dataValue: 4 }
]

export const Demo = (props: ObjectType) => {
    const { autoKey, ...rest } = props
    return <Select options={autoKey ? ops : options} {...rest} />
}

export const demoJson = (str = "", autoKey = false) => `
import { Select } from "esy-ui"
import React from "react"

const options = ${JSON.stringify(autoKey ? ops : options)}

export const Demo = () => {

    return (
        <Select options={options} ${str} />
    )
}
`
